<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:53:"E:\WWW\waimai/app/admin/index\view\account\index.html";i:1501906076;s:53:"E:\WWW\waimai/app/admin/index\view\template\base.html";i:1495522842;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="__STATIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <!--图标字体元件库-->
    <link rel="stylesheet" href="__STATIC__/plugins/font-awesome4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="__STATIC__/admin/css/AdminLTE.min.css">
    <link rel="stylesheet" href="__STATIC__/admin/css/jquery.datetimepicker.css">
    <link rel="stylesheet" href="__STATIC__/admin/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="__STATIC__/plugins/validform/5.3.2/css/Validateform_v5.3.2.css">

    <link rel="stylesheet" href="__STATIC__/plugins/bootstrap-table/bootstrap-table.min.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/polaris/polaris.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/futurico/futurico.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/line/_all.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/square/_all.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/flat/_all.css">
    <link rel="stylesheet" href="__STATIC__/plugins/iCheck/minimal/_all.css">
    

    <title><?php echo \think\Config::get('site.title'); ?></title>
    

    <script src="__STATIC__/plugins/jquery/jquery-3.0.0.min.js"></script>
    <script src="__STATIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="__STATIC__/admin/js/app.min.js"></script>
    <script src="__STATIC__/admin/extend/app.js"></script>

    <script src="__STATIC__/admin/extend/H-ui.admin.js"></script>
    <script src="__STATIC__/plugins/layer3.0.3/layer.js"></script>
    <script src="__STATIC__/plugins/validform/5.3.2/Validform_v5.3.2_min.js"></script>

    <script src="__STATIC__/plugins/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
    <script src="__STATIC__/plugins/bootstrap-table/bootstrap-table-zh-CN.js" type="text/javascript"></script>

    <script src="__STATIC__/plugins/iCheck/icheck.min.js"></script>
    <script>

        var admin_menu_data=<?php if(isset($admin_menu)): ?><?php echo $admin_menu; endif; ?>;
        $(function () {
            $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
                checkboxClass: 'icheckbox_minimal-blue',
                radioClass: 'iradio_minimal-blue'
            });
        })
    </script>

    
</head>
<body class="hold-transition skin-blue-light sidebar-mini">
    
<div class="row">
    <div class="col-xs-12">
        <div class="box-body">
            <div class="row">
                <div class="col-xs-3">
                    <div class="input-group col-xs-12">
                        <span class="input-group-addon">关键字</span>
                        <input type="text" class="form-control" id="keyword" placeholder=""/>
                    </div>
                </div>
                <div class="col-xs-3">
                    <div class="input-group col-xs-12">
                        <span class="input-group-addon">注册时间</span>
                        <input class="form-control datetimepicker" type="text" name="begindate"
                               id="begindate" placeholder="起始日期"/>
                        <span class="input-group-addon" style="width:1em;">至</span>
                        <input class="form-control datetimepicker" type="text" name="enddate" id="enddate"
                               placeholder="截止日期"/>
                    </div>
                </div>
                <div class="col-xs-1">
                    <div class="input-group col-xs-12">
                        <select class="form-control select2" id="sel_status">
                            <option selected="selected" value="-1">全部状态</option>
                            <option value="0">正常</option>
                            <option value="1">锁定</option>
                        </select>
                    </div>
                </div>
                <div class="col-xs-1">
                    <button type="button" class="btn btn-primary" id="btn_search"><i
                            class="glyphicon glyphicon-search"></i> 搜索
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-body">
                <table id="table"
                       data-toggle="table"
                       data-striped="true"
                       data-query-params="requestParam"
                       data-side-pagination="server"
                       data-pagination="true"
                       data-id-field="id"
                       data-url="<?php echo url('Account/index_data'); ?>"
                >
                    <thead>
                    <tr>
                        <th data-field="id">ID</th>
                        <th data-field="headimg" data-formatter="formatimg">头像</th>
                        <th data-field="nick">昵称</th>
                        <th data-field="name">真实姓名</th>
                        <th data-field="role_name">角色</th>
                        <th data-field="wechat">微信</th>
                        <th data-field="mobile">电话</th>
                        <th data-field="email">邮箱</th>
                        <th data-field="money">账户余额</th>
                        <th data-field="flag_lock" data-formatter="formatStatus">状态</th>
                        <th data-field="reg_time" data-formatter="formatTime">注册时间</th>
                        <th data-field="operate" data-formatter="formatOperate" data-events="operateEvents">操作</th>
                    </tr>
                    </thead>
                </table>
            </div><!-- /.box-body -->
        </div><!-- /.box -->

    </div><!-- /.col -->
</div><!-- /.row -->

</body>
<script src="__STATIC__/admin/js/skins_control.js"></script>
<script src="__STATIC__/admin/js/jquery.datetimepicker.js"></script>

<script>
    var add_data_url = "<?php echo url('Account/add'); ?>";
    var detail_data_url = "<?php echo url('Account/detail'); ?>";
    var edit_data_url = "<?php echo url('Account/edit'); ?>";
    var delete_data_url = "<?php echo url('Account/delete'); ?>";
    var update_role_url = "<?php echo url('Account/updaterole'); ?>";
    var ROOT = "__ROOT__";
</script>
<script>
    $('.datetimepicker').datetimepicker({
        format: "Y-m-d",
        lang: 'ch',
        timepicker: false
    });
</script>
<script>
    // <editor-fold defaultstate="collapsed" desc="格式化url">
    function urlFormat(url) {
        if (url.indexOf('.html')) {
            url = url.replace('.html', '')
        }
        return url;
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="查询">

    $("#sel_status").on('change', function () {
        $('#table').bootstrapTable('refresh');
    })

    //搜索按钮事件
    $("#btn_search").on('click', function () {
        $('#table').bootstrapTable('refresh');
    })

    var temp = {};
    function requestParam(params) {
        temp = {
            limit: params.limit, //页面大小
            offset: params.offset, //页码
            order: params.order,
            sort: params.sort,
            search: $("#keyword").val(),
            status: $("#sel_status").val(),
            begindate: $("#begindate").val(),
            enddate: $("#enddate").val()
        };
        return temp;
    }

    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="添加">
    $('#add_btn').on('click', function () {
        layer_open('添加', add_data_url)
    });
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="操作按钮">
    function formatOperate(value, row, index) {
        var setstr = '<button class="btn btn-primary btn-xs row_delivery" href="javascript:void(0)"><i class="fa fa-edit"></i>设置配送员</button>';
        return [
            '<button class="btn btn-success btn-xs row_detail" href="javascript:void(0)">',
            '<i class="fa fa-edit"></i> 详情',
            '</button>&nbsp;',
            '<button class="btn btn-danger btn-xs row_delete" href="javascript:void(0)">',
            '<i class="fa fa-trash"></i> 删除',
            '</button>&nbsp;' + setstr
        ].join('');
    }

    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="操作函数">
    window.operateEvents = {
        'click .row_detail': function (e, value, row, index) {
            full_page('会员详情', urlFormat(detail_data_url) + "/id/" + row.id);
        },
        'click .row_edit': function (e, value, row, index) {
            layer_open('更改会员信息', urlFormat(edit_data_url) + "/id/" + row.id);
        },
        'click .row_delete': function (e, value, row, index) {
            layer.confirm('你确定要删除该选项吗？', {btn: ['确定', '取消']}, function () {
                $.ajax({
                    dataType: 'json',
                    data: {id: row.id},
                    url: delete_data_url,
                    success: function (res) {
                        if (res.success) {
                            layer.msg(res.message, {time: 1000}, function () {
                                $('#table').bootstrapTable('refresh');
                            });
                        } else {
                            layer.alert(res.message);
                        }
                    }
                })
            })
        },

        'click .row_delivery': function (e, value, row, index) {
            layer.confirm('你确定要“' + $(this).text() + '”吗？', {btn: ['确定', '取消']}, function () {
                $.ajax({
                    dataType: 'json',
                    data: {id: row.id, role_id: 2},
                    url: update_role_url,
                    success: function (res) {
                        if (res.success) {
                            layer.msg(res.message, {time: 1000}, function () {
                                $('#table').bootstrapTable('refresh');
                            });
                        } else {
                            layer.alert(res.message);
                        }
                    }
                })
            })
        },

    }

    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="时间格式化">
    function formatTime(value) {
        if (value) {
            var date = new Date(parseInt(value) * 1000);
            Y = date.getFullYear() + '-';
            M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
            D = (date.getDate() + 1 < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
            h = (date.getHours() + 1 < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
            m = (date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
            s = (date.getSeconds() + 1 < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
            return Y + M + D + h + m + s;
        }

    }
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="状态格式化">
    function formatStatus(value) {
        switch (value) {
            case 0:
                return '<i class="fa fa-check-circle text-green" title="正常">正常</i>';
                break;
            case 1:
                return '<i class="fa fa-minus-circle text-yellow" title="锁定">锁定</i>';
                break;
        }

    }
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="时间格式化">
    function formatTime(value) {
        if (value) {
            var date = new Date(parseInt(value) * 1000);
            Y = date.getFullYear() + '-';
            M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
            D = (date.getDate() + 1 < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
            h = (date.getHours() + 1 < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
            m = (date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
            s = (date.getSeconds() + 1 < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
            return Y + M + D + h + m + s;
        }

    }
    // </editor-fold>


    // <editor-fold defaultstate="collapsed" desc="图片">
    function formatimg(value) {
        return '<img src="' + ROOT + value + '"  height="50" width="50"></img>';
    }
    // </editor-fold>

</script>

</html>